import { require } from "./request";
// import Qs from "qs";

export default {
  //管理员登陆
  loginAdmin(params) {
    return require({
      method: "post",
      headers: { "Content-Type": "application/json" },
      url: "/admin/login",
      data: params,
    });
  },
  //用户
  getUser(params) {
    return require({
      method: "post",
      headers: { "Content-Type": "application/json" },
      url: "/userInfo/all",
      data: params,
    });
  },
  changeUserPassword(params) {
    return require({
      method: "post",
      headers: { "Content-Type": "application/json" },
      url: "/userCenter/updatePassword",
      data: params,
    });
  },
  changeUserStatus(params) {
    return require({
      method: "post",
      headers: { "Content-Type": "application/json" },
      url: "/userInfo/changeUserStatus",
      data: params,
    });
  },
  userDetail(id) {
    return require({
      url: `/userInfo/detail/${id}`,
    });
  },
  register(params) {
    return require({
      method: "post",
      headers: { "Content-Type": "application/json" },
      url: "/user/register",
      data: params,
    });
  },
  userLogin(params) {
    return require({
      method: "post",
      headers: { "Content-Type": "application/json" },
      url: "/user/login",
      data: params,
    });
  },

  //活动

  getActivityList(params) {
    return require({
      method: "post",
      headers: { "Content-Type": "application/json" },
      url: "/activity/all",
      data: params,
    });
  },
  addActivity(params) {
    return require({
      method: "post",
      headers: { "Content-Type": "application/json" },
      url: "/activity/add",
      data: params,
    });
  },
  deleteAct(id) {
    return require({
      url: `/activity/delete/${id}`,
    });
  },
  actDetail(id) {
    return require({
      url: `/activity/detail/${id}`,
    });
  },
  activityPlace() {
    return require({
      url: `/activity/place/record`,
    });
  },
  actUserDetail(id) {
    return require({
      url: `/activity/userActivityDetail/${id}`,
    });
  },
  userActivityPage(params) {
    return require({
      method: "post",
      headers: { "Content-Type": "application/json" },
      url: "/activity/userActivityPage",
      data: params,
    });
  },
  buyActivity(params) {
    return require({
      method: "post",
      headers: { "Content-Type": "application/json" },
      url: "/activity/buy",
      data: params,
    });
  },
  //首页
  getHomeData() {
    return require({
      url: `/index`,
    });
  },

  //商品
  getCommodityList(params) {
    return require({
      method: "post",
      headers: { "Content-Type": "application/json" },
      url: "/commodity/get",
      data: params,
    });
  },
  addCommodity(params) {
    return require({
      method: "post",
      headers: { "Content-Type": "application/json" },
      url: "/commodity/add",
      data: params,
    });
  },
  deleteCommodity(params) {
    return require({
      method: "post",
      headers: { "Content-Type": "application/json" },
      url: "/commodity/delete ",
      data: params,
    });
  },
  updataCommodity(params) {
    return require({
      method: "post",
      headers: { "Content-Type": "application/json" },
      url: "/commodity/update",
      data: params,
    });
  },
  commodityDetail(id) {
    return require({
      url: `/commodity/detail/${id}`,
    });
  },
  userCommodityPage(params) {
    return require({
      method: "post",
      headers: { "Content-Type": "application/json" },
      url: "/commodity/userCommodityPage",
      data: params,
    });
  },
  buyCommodity(params) {
    return require({
      method: "post",
      headers: { "Content-Type": "application/json" },
      url: "/commodity/buy",
      data: params,
    });
  },
  // 课程
  getCourseList(params) {
    return require({
      method: "post",
      headers: { "Content-Type": "application/json" },
      url: "/course/all",
      data: params,
    });
  },
  addCourse(params) {
    return require({
      method: "post",
      headers: { "Content-Type": "application/json" },
      url: "/course/add",
      data: params,
    });
  },
  deleteCourse(params) {
    return require({
      method: "post",
      headers: { "Content-Type": "application/json" },
      url: "/course/delete ",
      data: params,
    });
  },
  courseDetail(id) {
    return require({
      url: `/course/detail/${id}`,
    });
  },
  userCoursePage(params) {
    return require({
      method: "post",
      headers: { "Content-Type": "application/json" },
      url: "/course/userCoursePage",
      data: params,
    });
  },
  courseUserDetail(id) {
    return require({
      url: `/course/user/detail/${id}`,
    });
  },
  buyCourse(params) {
    return require({
      method: "post",
      headers: { "Content-Type": "application/json" },
      url: "/course/buy",
      data: params,
    });
  },
  //订单
  getOrderList(params) {
    return require({
      method: "post",
      headers: { "Content-Type": "application/json" },
      url: "/order/all",
      data: params,
    });
  },
  orderDetail(id) {
    return require({
      url: `/order/detail/${id}`,
    });
  },
  //场地
  getPlaceList() {
    return require({
      url: `/place/getAll`,
    });
  },
  updatePlace(params) {
    return require({
      method: "post",
      headers: { "Content-Type": "application/json" },
      url: "/place/update",
      data: params,
    });
  },
  placeDetail(id) {
    return require({
      url: `/place/detail/${id}`,
    });
  },
  reservePlace(params) {
    return require({
      method: "post",
      headers: { "Content-Type": "application/json" },
      url: "/place/reserve",
      data: params,
    });
  },
  uploadPic(params) {
    return require({
      method: "post",
      headers: { "Content-Type": "multipart/form-data" },
      url: "/place/uploadPic",
      data: params,
    });
  },
  uploadActivityPic(params) {
    return require({
      method: "post",
      headers: { "Content-Type": "multipart/form-data" },
      url: "/activity/uploadPic",
      data: params,
    });
  },
  getAbleDate(id) {
    return require({
      url: `/place/getAbleDate/${id}`,
    });
  },
  getAbleDateId(params) {
    return require({
      method: "post",
      headers: { "Content-Type": "application/json" },
      url: "/place/reserve/detail",
      data: params,
    });
  },
  //个人中心
  userCenterOrder(params) {
    return require({
      method: "post",
      headers: { "Content-Type": "application/json" },
      url: "/userCenter/order",
      data: params,
    });
  },
  userCenterCourse(params) {
    return require({
      method: "post",
      headers: { "Content-Type": "application/json" },
      url: "/userCenter/course",
      data: params,
    });
  },
  userCenterTicket(params) {
    return require({
      method: "post",
      headers: { "Content-Type": "application/json" },
      url: "/userCenter/ticket",
      data: params,
    });
  },
  userCenterPlace(params) {
    return require({
      method: "post",
      headers: { "Content-Type": "application/json" },
      url: "/userCenter/place",
      data: params,
    });
  },
  createOrder(params) {
    return require({
      method: "post",
      headers: { "Content-Type": "application/json" },
      url: "/alipayOrder/createOrder",
      data: params,
    });
  },
  getPcPayment(subject, id, totalAmount) {
    return require({
      url: `/alipay/pcPayment?subject=${subject}&outTradeNo=${id}&totalAmount=${totalAmount}`,
    });
  },
  pcPayment(params) {
    return require({
      method: "post",
      headers: { "Content-Type": "application/json" },
      url: "/alipayOrder/pcPayment",
      data: params,
    });
  },
  //通知
  getInfoPage(params) {
    return require({
      method: "post",
      headers: { "Content-Type": "application/json" },
      url: "/inform/page",
      data: params,
    });
  },
  getInfoDetail(id) {
    return require({
      url: `/inform/detail/${id}`,
    });
  },
  getUserBalance() {
    return require({
      url: `/userCenter/getBalance`,
    });
  },
};
